package com.zhongen.wflow.workflow.config.listener;

import org.flowable.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.ContextRefreshedEvent;

/**
 * flowable全局监听器
 *
 * @author : willian fu
 * @date : 2022/8/27
 */
@Configuration
public class FlowableGlobalListener implements ApplicationListener<ContextRefreshedEvent> {

	@Autowired
	private GlobalTaskListener globalTaskListener;

	@Autowired
	private RuntimeService runtimeService;

	@Override
	public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
		runtimeService.addEventListener(globalTaskListener);
	}

}
